//
//  WSOrderDisplayViewController.m
//  WisdomStar
//
//  Created by 谭飞 on 2018/11/16.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "WSOrderDisplayViewController.h"
#import "WSOrderViewController.h"

@interface WSOrderDisplayViewController ()

@property (nonatomic, strong) NSArray *titles;

@end

@implementation WSOrderDisplayViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"我的订单";
    [self setup];
    
    [self setUpAllViewController];
}

- (void)setup {
    self.view.backgroundColor = kCommonBackgroudColor;
    
    // 设置整体内容尺寸（包含标题滚动视图和底部内容滚动视图）
    [self setUpContentViewFrame:^(UIView *contentView) {
        contentView.frame = CGRectMake(0, 0, kMainScreenWidth, kMainScreenHeight - TOPBARHEIGHT);
        
    }];
    
    // 设置标题
    [self setUpTitleEffect:^(UIColor *__autoreleasing *titleScrollViewColor, UIColor *__autoreleasing *norColor, UIColor *__autoreleasing *selColor, UIFont *__autoreleasing *titleFont, CGFloat *titleHeight, CGFloat *titleWidth) {
        *norColor = kFontColorBlack;
        *selColor = kFontColorGreen;
        *titleFont = WSFontMake(14);
    }];
    
    // 设置标题渐变
    // *推荐方式(设置标题渐变)
    [self setUpTitleGradient:^(YZTitleColorGradientStyle *titleColorGradientStyle, UIColor *__autoreleasing *norColor, UIColor *__autoreleasing *selColor) {
        // nothing
    }];
    
    // 设置下划线
    [self setUpUnderLineEffect:^(BOOL *isUnderLineDelayScroll, CGFloat *underLineH, UIColor *__autoreleasing *underLineColor,BOOL *isUnderLineEqualTitleWidth) {
        *underLineColor = kThemeGreenColor;
        *isUnderLineDelayScroll = YES;
        *isUnderLineEqualTitleWidth = YES;
    }];
}

/**
 添加底部内容控制器
 */
- (void)setUpAllViewController {
    [self.titles enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        WSOrderViewController *childVc = [[WSOrderViewController alloc] init];
        childVc.title = obj;
//        childVc.isLoad = idx == 0;
        [self addChildViewController:childVc];
    }];
}

#pragma mark - Getter

- (NSArray *)titles {
    if (_titles == nil) {
        _titles = @[@"全部",@"待付款",@"待发货",@"待收货",@"待评价"];
    }
    return _titles;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
